package com.honour.service.interfaced.impl;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import com.honour.service.interfaced.CircleInManager;
import com.system.dao.DaoSupport;
import com.system.util.PageData;

/** 
 * 说明： 圈子中心
 * 创建人：zhaozhenhua
 * 创建时间：2017-12-06
 * @version
 */
@Service("circleInService")
public class CircleInService implements CircleInManager{

	@Resource(name = "daoSupport")
	private DaoSupport dao;
	
	/**新增
	 * @param pd
	 * @throws Exception
	 */
	public void save(PageData pd)throws Exception{
		dao.save("CircleInMapper.save", pd);
	}
	
	/**删除
	 * @param pd
	 * @throws Exception
	 */
	public void delete(PageData pd)throws Exception{
		dao.delete("CircleInMapper.delete", pd);
	}
	
	/**修改
	 * @param pd
	 * @throws Exception
	 */
	public void edit(PageData pd)throws Exception{
		dao.update("CircleInMapper.edit", pd);
	}

	/**通过用户的ID获取数据
	 * @param pd
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<PageData> getCircleListById(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("CircleInMapper.getCircleListById", pd);
	}
	
	/**遍历获取我和我关注的好友的所有圈子并根据时间排序
	 * @param pd
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<PageData> getAllCircleListByIds(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("CircleInMapper.getAllCircleListByIds", pd);
	}

	/**点赞
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public void saveDotAgree(PageData pd) throws Exception {
		dao.save("DotAgreeInMapper.save", pd);
		
	}

	/**统计点赞次数 
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public Integer getDotAgreeCount(PageData pd) throws Exception {
		return (Integer)dao.findForObject("DotAgreeInMapper.getDotAgreeCount", pd);
	}

	/**判断自己是否点赞 
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public PageData getDotAgreeMy(PageData pd) throws Exception {
		return (PageData)dao.findForObject("DotAgreeInMapper.getDotAgreeMy", pd);
	}

	/**保存评论
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public void saveComment(PageData pd) throws Exception {
		dao.save("CommentInMapper.save", pd);
	}

	/**修改评论
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public void editComment(PageData pd) throws Exception {
		dao.update("CommentInMapper.edit", pd);
	}

	/**删除评论
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public void deleteComment(PageData pd) throws Exception {
		dao.delete("CommentInMapper.delete", pd);
	}

	/**统计评论次数
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public Integer getCommentCount(PageData pd) throws Exception {
		return (Integer)dao.findForObject("CommentInMapper.getCommentCount", pd);
	}

	/**通过圈子ID获取所有评论
	 * @param pd
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<PageData> getCommentListById(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("CommentInMapper.getCommentListById", pd);
	}

	/**统计踩点数量 
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public Integer getComLossAgreeCount(PageData pd) throws Exception {
		return (Integer)dao.findForObject("ComDotAgreeInMapper.getComLossAgreeCount", pd);
	}
	
	/**点赞
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public void saveComDotAgree(PageData pd) throws Exception {
		dao.save("ComDotAgreeInMapper.save", pd);
		
	}

	/**统计点赞次数 
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public Integer getComDotAgreeCount(PageData pd) throws Exception {
		return (Integer)dao.findForObject("ComDotAgreeInMapper.getComDotAgreeCount", pd);
	}

	/**判断自己是否点赞 
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public PageData getComDotAgreeMy(PageData pd) throws Exception {
		return (PageData)dao.findForObject("ComDotAgreeInMapper.getComDotAgreeMy", pd);
	}
	
	/**根据圈子中心ID获取圈子信息
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public PageData getCircleById(PageData pd) throws Exception {
		return (PageData)dao.findForObject("CircleInMapper.findById", pd);
	}
	
	/**根据评论ID获取评论或回复信息
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public PageData getCommentById(PageData pd) throws Exception {
		return (PageData)dao.findForObject("CommentInMapper.findById", pd);
	}

	/**添加话题
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public void addTopic(PageData pd) throws Exception {
		dao.save("TopicInMapper.save", pd);
	}

	/**获取话题列表(含模糊查询)
	 * @param pd
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<PageData> getTopicList(PageData pd) throws Exception {
		return (List<PageData>)dao.findForList("TopicInMapper.getTopicList", pd);
	}

	/**根据话题查询 
	 * @param pd
	 * @throws Exception
	 */
	@Override
	public PageData getTopicByTitle(PageData pd) throws Exception {
		return (PageData)dao.findForObject("TopicInMapper.getTopicByTitle", pd);
	}

	
	/**
	 * 获取筛选后的黑微博列表
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<PageData> getScreenList(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("TopicInMapper.getScreenList", pd);
	}
	
}

